<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>用户管理</title>
<link href="${path}/statics/weui/style/weui.css" rel="stylesheet"/>
<link href="${path}/statics/weui/style/weui2.css" rel="stylesheet"/>
<link href="${path}/statics/weui/style/weui3.css" rel="stylesheet"/>
<link href="${path}/statics/css/wap.css" rel="stylesheet">
<script src="${path}/statics/libs/jquery.min.js"></script>
</head>
<body>
<!-- 整体框架 -->
<div class="wrapper index">

	<!-- 页头 -->
<%-- 	<%@ include file="header.jsp" %> --%>
	<!-- 主体 -->
	<div class="main">
		<div class="box">
		
		    <div class="page-title">
            <h3>车主列表</h3>
          </div>
			<div class="find">
		      <form id="searForm" action="lists" method="post">
          <div class="weui_search_bar">
          <input type="hidden" name="commit" value="1">
                  <div class="weui_search_outer">
                      <div class="weui_search_inner">
                        <input type="text" class="weui_search_input" name="nickname" value="${nickname}" placeholder="输入姓名搜索" />
                      </div>
                    </div>
                </div>
                </form>
                <div class="weui_btn_area">
                  <a href="javascript:;" class="weui_btn weui_btn_primary" onclick="return subForm();">搜索</a>
                </div>    
		    </div>
			<div class="page slideIn cell">
			<c:forEach items="${list }" var="v">
			<!-- 序号:${item.id } -->
			<div class="weui_cells">
              <div class="weui_cell">
              
               <div class="weui_cell_bd weui_cell_primary">
                  <p>ID</p>
               </div>
               <div class="weui_cell_ft">${v. id}</div>
              </div>
              
              <div class="weui_cell" >
              <div class="weui_cell_bd weui_cell_primary">
                  <p>openID</p>
               </div>
               <div class="weui_cell_ft">${v. openid}</div>
              </div>
               
               <div class="weui_cell" >
              <div class="weui_cell_bd weui_cell_primary">
                  <p>国际</p>
               </div>
               <div class="weui_cell_ft">${v. nickname}</div>
              </div>
             
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                  <p>用户类型</p>
               </div>
               <div class="weui_cell_ft">
			     <c:choose>	
			 	   <c:when test="${item.userName != null && item.userName == 'admin' }">
			 		超级管理员
			 	   </c:when>
			 	  <c:otherwise>
					<select id="btn"  name="type" onchange="ajaxSelect(this[selectedIndex].value,${v. id });" >
						<option value="1" ${v.userid == 1?'selected="selected"':''}>驾驶员</option>
						<option value="2" ${v.userid == 2?'selected="selected"':''}>管理员</option>
					</select>
			 	  </c:otherwise>
			     </c:choose>
			   </div>
             </div>
             
		   <div class="button_sp_area">
             <a href="info/${v.id }" class="weui_btn weui_btn_plain_default">修改信息</a>
		   </div>
		   </div>
		   </c:forEach>
		
    
		   </div>
		   	<!--分页--> 
				<div class="paging">
				<a href="../Tests/lists?pageNo=1">首页</a>
					<c:choose>
						<c:when test="${page.pageNo==1 }">
							<span>上一页</span>
						</c:when>
						<c:otherwise>
							<a href="../Tests/lists?pageNo=${page.pageNo-1 }">上一页</a>
						</c:otherwise>
					</c:choose>

					<c:choose>
						<c:when test="${page.pageNo==totalPage || totalPage==0}">
							<span>下一页</span>
						</c:when>
						<c:otherwise>
							<a href="../Tests/lists?pageNo=${page.pageNo+1 }">下一页</a>
						</c:otherwise>
					</c:choose>
					<a href="../Tests/lists?pageNo=${totalPage }">尾页</a>
				</div>
		</div>
	</div>
</div>
    

<script type="text/javascript">
function ajaxSelect(type,id){
	//alert("++++++"+type+"++++++++"+id);
	$.ajax({
		  type: "POST",
	      url:"../Tests/update",
	      data:{'userid':type,'id':id},
	      success:function(){
	        alert("修改成功");
	      }
	    });
	
}

</script>


</body>
</html>